Skip to content

Min Log Level#3121

Merged
harsimar merged 5 commits intomainfrom
harskaur/nlogMinLevel
Feb 20, 2026
Merged

Min Log Level#3121
harsimar merged 5 commits intomainfrom
harskaur/nlogMinLevel

Conversation

@harsimar
Copy link
Copy Markdown
Member

@harsimar harsimar commented Feb 19, 2026

Fix bug where Debug/Trace level logs from TrackTrace API were not emitted to Application Insights

potential fix for github issue 3118.

@harsimar harsimar marked this pull request as ready for review February 20, 2026 18:28
Copilot AI review requested due to automatic review settings February 20, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an issue where TrackTrace calls with SeverityLevel.Verbose (and corresponding debug-level NLog traces) were being silently dropped by the logger filter. The fix centralizes the minimum log level configuration by adding a category-specific LoggerFilterRule for the TelemetryClient logger in the WithApplicationInsights extension method, setting the minimum level to Trace.

Changes:

  • Added a LoggerFilterRule in OpenTelemetryBuilderExtensions.WithApplicationInsights() to set minimum log level to Trace for the TelemetryClient category
  • Removed the global MinLevel = LogLevel.Trace configuration from TelemetryTestEnvironment as it's now centralized
  • Updated tests to include SeverityLevel.Verbose and adjusted assertion count from 4 to 5
  • Updated example applications to demonstrate Trace level logging

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
BASE/src/Microsoft.ApplicationInsights/OpenTelemetryBuilderExtensions.cs Adds category-specific LoggerFilterRule for TelemetryClient to set minimum log level to Trace
LOGGING/test/NLogTarget.Tests/TelemetryTestEnvironment.cs Removes global MinLevel configuration that's now handled centrally
BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/TelemetryClientTest.cs Adds test coverage for SeverityLevel.Verbose and updates assertion count
examples/NLogConsoleApp/nlog.config Changes NLog configuration to use Trace level for Application Insights target
examples/NLogConsoleApp/Program.cs Changes NLog internal logger level to Trace for demonstration
examples/BasicConsoleApp/Program.cs Adds example TrackTrace call with SeverityLevel.Verbose

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@harsimar harsimar merged commit d6bd09d into main Feb 20, 2026
18 checks passed
@harsimar harsimar deleted the harskaur/nlogMinLevel branch February 20, 2026 19:40
This was referenced Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants